﻿<?php
$action = '';
if(isset($_GET['action'])) $action = $_GET['action'];
if($action == 'mysql') {
	$link = mysql_connect('localhost', 'root', 'toor');
	if($link)
		echo "MySQL连接成功！";
	else
		echo "MySQL连接失败！";
		mysql_close();
} elseif($action == 'memory') {
	$t = 0;
	echo memory_get_usage() - $t, ' ',$t = memory_get_usage(), PHP_EOL;
	$a = array();
	echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
	$a[] = 1;
	echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
	$a[] = 2;
	echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
	$a[] = 3;
	echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
} elseif($action == 'test') {
	$args = array('天柏CA', '11', '13');
	$format = "%1\$s%2\$s CA代码:%3\$s 盒号长度:%3\$d位";
	array_unshift($args, $format);
	echo call_user_func_array('sprintf', $args);
} else {
	phpinfo();
}
?>